package com.lagou.rpc.consumer.client;

import java.util.Objects;

public class ServerInfo {
    private String ip;
    private int port;
    private long lastTimeElapsed;

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public long getLastTimeElapsed() {
        return lastTimeElapsed;
    }

    public void setLastTimeElapsed(long lastTimeElapsed) {
        this.lastTimeElapsed = lastTimeElapsed;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServerInfo that = (ServerInfo) o;
        return port == that.port && Objects.equals(ip, that.ip);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ip, port);
    }

    @Override
    public String toString() {
        return "ServerInfo{" +
                "ip='" + ip + '\'' +
                ", port=" + port +
                ", lastTimeElapsed=" + lastTimeElapsed +
                '}';
    }
}
